{
	//基本语法
	class Parent{
		//构造函数
		constructor(name='yaozhen') {//赋默认值
			this.name=name;
		}
	}
	let p1=new Parent();
	let p2=new Parent('姚振');
	console.log(p1,p2)//Parent {name: "yaozhen"} Parent {name: "姚振"}
}
{
	//继承
	class Parent{
		constructor(name='yaozhen') {
			this.name=name;
		}
	}
	class Child extends Parent{
	}
	console.log(new Child())//{name: "yaozhen"},默认继承父类name属性
}
{
	//继承传递参数
	class Parent{
		constructor(name='yaozhen') {
			this.name=name;
		}
	};
	class Child extends Parent{
		constructor(name='heyi') {
			//super表示继承父类属性,传递参数覆盖父类的值
			super(name);//super一定要写在最前面
			this.type='哈哈';
		}
	}
	console.log(new Child())//{name: "heyi", type: "哈哈"}
}
{
	//getter与setter,这两个是属性,不是方法
	class Parent{
		constructor(name='yaozhen') {
			this.name=name;
		}
		//定义longName的get属性
		get longName(){
			return '哈哈'+this.name;
		}
		//set
		set longName(value){
			this.name=value;
		}
	};
	let v=new Parent();
	//get属性获取
	console.log(v.longName);//哈哈yaozhen
	//set属性设置
	v.longName='呵呵';
	console.log(v.longName)//哈哈呵呵
}
{
	//静态方法
	class Parent{
		constructor(name='yaozhen') {
			this.name=name;
		}
		//只能用类调用,不能用实例调用
		static tell(){
			console.log("静态方法")
		}
	}
	console.log(Parent.tell());
	//静态属性只能使用类赋值
	Parent.type='ho9';
}
